package com.pubinfo.passbook.common.model.ruler;

import lombok.Data;
import org.dom4j.Element;

import java.math.BigDecimal;

@Data
public class Detail
{
    /*项目编码*/
    private String itemCode;
    /*项目名称*/
    private String itemName;
  /*金额*/
  private BigDecimal itemAmount = BigDecimal.ZERO;
  /*单位*/
  private String itemUnit;
  /*数量*/
  private BigDecimal itemQuantity = BigDecimal.ZERO;
  /*标准*/
  private String itemStd;
  /*自费金额*/
  private BigDecimal itemAmountSelf = BigDecimal.ZERO;
  /*自费比例*/
  private Double itemAmountPercent;
  /*项目单价*/
  private BigDecimal itemAmountPrice = BigDecimal.ZERO;
  /*收费类别*/
  private String itemAmountType;

    public Detail() {
    }

    public Detail(Element elm)
    {
      if (elm.element("ItemCode") != null) {
        this.itemCode = elm.element("ItemCode").getText();
      }
      if (elm.element("ItemName") != null) {
        this.itemName = elm.element("ItemName").getText();
      }
      if (elm.element("ItemAmount") != null) {
        this.itemAmount = new BigDecimal(elm.element("ItemAmount").getText());
      }
      if (elm.element("ItemUnit") != null) {
        this.itemUnit = elm.element("ItemUnit").getText();
      }
      if (elm.element("ItemQuantity") != null) {
        this.itemQuantity = new BigDecimal(elm.element("ItemQuantity").getText());
      }
      if (elm.element("ItemStd") != null) {
        this.itemStd = elm.element("ItemStd").getText();
      }
      Element itemExt = elm.element("ItemExt");
      if (itemExt != null) {
        if (itemExt.element("ItemAmountSelf") != null) {
          this.itemAmountSelf = new BigDecimal(itemExt.element("ItemAmountSelf").getText());
        }
        if (itemExt.element("ItemAmountPercent") != null) {
          this.itemAmountPercent = new Double(itemExt.element("ItemAmountPercent").getText());
        }
        if (itemExt.element("ItemAmountPrice") != null) {
          this.itemAmountPrice = new BigDecimal(itemExt.element("ItemAmountPrice").getText());
        }
        if (itemExt.element("ItemAmountType") != null) {
          this.itemAmountType = itemExt.element("ItemAmountType").getText();
        }
      }
  
    }
}
